
	/************************************************************************************************

		@API
		Factory: jsl.Boolean

		Methods:
			obj		Boolean		(b)
			b			isTrue		()
			b			isFalse		()

	************************************************************************************************/

  //-------------------------------------------------------------------------------
  jsl.Boolean = function(v) {
  	try {
  		var prt, obj
  		//!
	    if(arguments.length > 1)					throw jsl.ParamError()
			if(arguments.length && v == null)	throw jsl.ParamError("NullValue:v")//!

			if(arguments.length)
				if(v instanceof Boolean)
					if(v.__augmented) return v
					else							obj = v
				else
					obj = new Boolean(v)

			else
				obj = new Boolean

			prt = jsl.Boolean.prototype

    	for(var id in prt) obj[id] = prt[id]
			return obj
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
  }
  //-------------------------------------------------------------------------------
	jsl.Boolean.__name 			= "jsl.Boolean"
  jsl.Boolean.__native		= { __name: true, __augmented: true }
	jsl.Boolean.__augmented	= true
  //-------------------------------------------------------------------------------
	jsl.Boolean.prototype						= jsl.Object()
	jsl.Boolean.prototype.__name 		= "jsl.Boolean"
	jsl.Boolean.prototype.__native 	= jsl.Object.clone(jsl.Object.prototype.__native)
  //-------------------------------------------------------------------------------
  jsl.Boolean.prototype.isTrue = function() {
    try {//!
			if(!jsl.isBoolean(this))	throw jsl.TypeError("BadMethodCall:Boolean")
      if(arguments.length)			throw jsl.ParamError()//!

      return !!+this
    }
    catch(e) {
      jsl.throwError(e, this, arguments)
    }
  }
  //-------------------------------------------------------------------------------
  jsl.Boolean.prototype.isFalse = function() {
    try {//!
			if(!jsl.isBoolean(this))	throw jsl.TypeError("BadMethodCall:Boolean")
      if(arguments.length)			throw jsl.ParamError()//!

      return !+this
    }
    catch(e) {
      jsl.throwError(e, this, arguments)
    }
  }
	//Boolean init
	//-------------------------------------------------------------------------------
	;(function() {
		var prt, Bln

		Bln = jsl.Boolean
		prt	= Bln.prototype

		for(var id in prt) {

			Bln.__native[id] = true
			prt.__native[id] = true

			if(typeof prt[id] === "function" && !prt[id].__name) {

				Bln[id] = function(obj) {
					try {//!
						if(!arguments.length)	throw jsl.ParamError()
						jsl.validate(obj, "b", "obj")//!

						return arguments.callee.__f.apply(obj, Array.prototype.slice.call(arguments, 1))
					}
					catch(e) {
						jsl.throwError(e, this, arguments)
					}
				}

				Bln[id].__name	= prt[id].__name = id
				Bln[id].__f			= prt[id]
			}
		}
	})()
